import React from "react";
import BaseComponent from "../../redare/components/BaseComponent";
import {Card, Descriptions, PageHeader} from "antd";
import GeneratorSysPresenter from "../../.gen/presenter/GeneratorSysPresenter";
import {WebPage} from "../../redare_components/webplatform_workbench/utils/WorkbenchDecoratorUtil";

const routes = [
    {
        path: '/',
        breadcrumbName: '首页'
    },
    {
        path: '/generatorsys/info',
        breadcrumbName: '业务系统详情'
    }
];

export default @WebPage({
    id: 'com.redare.devframework.webplatform.pages.generatorsys.GeneratorSysInfoPage',
    name: '业务系统详情',
    webPath: '/generatorsys/info'
})
class GeneratorSysInfoPage extends BaseComponent {


    constructor(props) {
        super(props);
        this.presenter = new GeneratorSysPresenter(this);
    }

    componentDidMount() {
        let {id} = this._urlQuery
        if (id) {
            this.showSpin()
            this.presenter.getGeneratorSys({id}, {}, (result) => {
                if (result) {
                    this.setState({data: result.data})
                }
            })
        }
    }

    render() {
        let {data} = this.state;
        if (!data) {
            data = {};
        }
        return (
            <div>
                <PageHeader onBack={() => this._onBack()} className="margin-bottom bg-white"
                            title='业务系统详情' routes={routes}/>
                {this.renderSpin(
                    <Card bordered={false} className="margin24">
                        <Descriptions>
                            <Descriptions.Item label="系统编码">{data.code}</Descriptions.Item>
                            <Descriptions.Item label="系统名称">{data.name}</Descriptions.Item>
                        </Descriptions>
                    </Card>
                )}
            </div>
        )
    }

    _onBack() {
        this.routeBack(this.props.history)
    }

    showLoadingIndicator(text, options = {}) {
        this.showSpin(text, options);
    }

    closeLoadingIndicator() {
        this.closeSpin();
    }
}





